package cn.caskm.souvenirshopsystem.controller.api;

import cn.caskm.souvenirshopsystem.domain.Result;
import cn.caskm.souvenirshopsystem.domain.dto.PageDTO;
import cn.caskm.souvenirshopsystem.domain.query.MyCollectQuery;
import cn.caskm.souvenirshopsystem.domain.vo.MyCollectVO;
import cn.caskm.souvenirshopsystem.service.GoodsCollectService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/collect")
@RequiredArgsConstructor
public class CollectController {

    private final GoodsCollectService goodsCollectService;

    @PostMapping("/goods")
    public Result<Object> collectGoods(@RequestParam("goodsId") Integer goodsId) {
        goodsCollectService.collectGoods(goodsId);
        return Result.success();
    }

    @GetMapping("/listMyCollect")
    public Result<PageDTO<MyCollectVO>> listMyCollect(MyCollectQuery query) {
        return goodsCollectService.goodsCollectService(query);
    }

}
